const { ipcRenderer } = require('electron');

// DOM node
const USD_XAU_PRICE = document.querySelector('#USD_XAU_PRICE');

const price = {
    start() {
        ipcRenderer.send('price-start');
    },
    stop() {
        ipcRenderer.send('price-stop');
    }
};

ipcRenderer.on('price-update', (event, arg) => {
    // console.log('pirce-update', event, arg) // prints "pong"

    // Update DOM note content
    USD_XAU_PRICE.textContent = arg;
});

module.exports.price = price;